/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package monitor;

import java.sql.SQLException;

/**
 *
 * @author owner
 */
public class Delete {
    
    
    String TutorID;
    String TuteeID;
    String SchedID;
    public void DeleteTutor(){
     
        //Delete Tutor Profile
        DBManager con0 = new DBManager();
        con0.Connect();
        QHandler Qhandler0 = new QHandler();
        Qhandler0.deleteTutorInfo(TutorID);
        con0.Push(Qhandler0.query);
        con0.Disconnect(con0.rs);
        
        //Delete Tutor Contact Number
        DBManager con1 = new DBManager();
        con1.Connect();
        QHandler Qhandler1 = new QHandler();
        Qhandler1.deleteTutorContact(TutorID);
        con1.Push(Qhandler1.query);
        con1.Disconnect(con1.rs);
        
        //Delete Tutor Schedule Details
        DBManager con2 = new DBManager();
        con2.Connect();
        QHandler Qhandler2 = new QHandler();
        Qhandler2.getSchedInfoTutor(TutorID);
        con2.getInfo(Qhandler2.query);
        
        
        DBManager con3 = new DBManager();
        QHandler Qhandler3 = new QHandler();
        con3.Connect();
        
        try{
        do{
        Qhandler3.deleteSched(con2.rs.getString("schedNum"));
        con3.Push(Qhandler3.query);
        }while(con2.rs.next());
        }catch(SQLException ex){}
        
        con2.Disconnect(con2.rs);
        con3.Disconnect(con3.rs);
        
        //Delete Tutor Course Details
        DBManager con4 = new DBManager();
        con4.Connect();
        QHandler Qhandler4 = new QHandler();
        Qhandler4.getIdCourseTutor(TutorID);
        con4.getInfo(Qhandler4.query);
        
        DBManager con5 = new DBManager();
        QHandler Qhandler5 = new QHandler();
        con5.Connect();
        
        try{
        do{
        Qhandler5.deleteTutorCourse(TutorID, con4.rs.getString("Course_courseCode"));
        con5.Push(Qhandler5.query);
        }while(con4.rs.next());
        }catch(SQLException ex){}
        
        con4.Disconnect(con4.rs);
        con5.Disconnect(con5.rs);
    
        
    }
    
    public void DeleteTutee(){
     
        DBManager con0 = new DBManager();
        con0.Connect();
        QHandler Qhandler0 = new QHandler();
        Qhandler0.deleteTuteeInfo(TuteeID);
        con0.Push(Qhandler0.query);
        con0.Disconnect(con0.rs);
    
        DBManager con1 = new DBManager();
        con1.Connect();
        QHandler Qhandler1 = new QHandler();
        Qhandler1.deleteTuteeContact(TuteeID);
        con1.Push(Qhandler1.query);
        con1.Disconnect(con1.rs);
        
        DBManager con2 = new DBManager();
        con2.Connect();
        QHandler Qhandler2 = new QHandler();
        Qhandler2.getSchedInfoTutee(TuteeID);
        con2.getInfo(Qhandler2.query);
        
        DBManager con3 = new DBManager();
        QHandler Qhandler3 = new QHandler();
        con3.Connect();
        
        try{
        do{
        Qhandler3.deleteSched(con2.rs.getString("schedNum"));
        con3.Push(Qhandler3.query);
        }while(con2.rs.next());
        }catch(SQLException ex){}
        
        con2.Disconnect(con2.rs);
        con3.Disconnect(con3.rs);
    }
    
    public void DeleteSched(){
        
        DBManager con = new DBManager();
        con.Connect();
        QHandler Qhandler = new QHandler();
        Qhandler.deleteSched(SchedID);
        con.Push(Qhandler.query);
        con.Disconnect(con.rs);
        
    }
}
